package com.xbai.spark.recall.util

import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession

/**
  * @author xbai
  * @Date 2021/1/11
  */
object SparkSessionUtil {

  def getSession(jobName: String, db: String): SparkSession = {
    val conf: SparkConf = new SparkConf().setMaster("local[*]").setAppName(jobName)
    val spark: SparkSession = SparkSession.builder().config(conf)
      .enableHiveSupport().getOrCreate()
    spark.sql("use " + db)
    spark
  }
}
